﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Diagnostics;

namespace EasyFFmpeg
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
        }

        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            MessageBox.Show(null, "An unhandled exception has occurred: " + e.Exception.Message, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            // try and log to the event log
            try
            {
                EventLog.WriteEntry("EasyFFmpeg", e.Exception.Message + Environment.NewLine + e.Exception.StackTrace, EventLogEntryType.Error);
            }
            catch (Exception)
            {
            }
        }
    }
}
